package com.example.androidpattern.strategy.classes;

import com.example.androidpattern.strategy.interfaces.IAttack;
import com.example.androidpattern.strategy.interfaces.IDisplay;

/**
 * @ClassName: Role$
 * @Description: java类作用描述
 * @Author: xinya
 * @CreateDate: 2020/11/11$ 11:02$
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
public class Role {
    private IAttack mAttack;
    private IDisplay mDisplay;

    public Role setAttack(IAttack attack) {
        mAttack = attack;
        return this;
    }

    public Role setDisplay(IDisplay display) {
        mDisplay = display;
        return this;
    }

    public void attack() {
        if (mAttack != null) {
            mAttack.attack();
        }
    }

    public void display() {
        if (mDisplay != null) {
            mDisplay.display();
        }
    }
}
